#!/usr/bin/env bash
rm -rf platforms/android/build/outputs/apk/
echo 删除多余apk

. scripts/update_ver.sh

gulp app
ionic prepare
#ionic state reset
echo 恢复插件成功
echo 开始压缩文件,上传至oss
./scripts/upload.py oss-cn-hangzhou.aliyuncs.com 02yUhyzfxsxzLCKA 6Cw3uKQKKRedocMtfZVfCxHoeZh2h6 yueguanjia-bucket www www_dist.zip app/customer/dist/www.zip
echo 上传结束
ionic build android --release
cp platforms/android/build/outputs/apk/android-release-unsigned.apk ygj-customer-$VERSION.apk
echo 移动目标文件完成
echo jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore sign.keystore ygj-customer-$VERSION.apk yueguanjia
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore sign.keystore ygj-customer-$VERSION.apk yueguanjia

echo 上传apk包到oss
echo ./scripts/upload_apk.py oss-cn-hangzhou.aliyuncs.com 02yUhyzfxsxzLCKA 6Cw3uKQKKRedocMtfZVfCxHoeZh2h6 yueguanjia-bucket ygj-customer-$VERSION.apk app/customer/apk/ygj-customer.apk
./scripts/upload_apk.py oss-cn-hangzhou.aliyuncs.com 02yUhyzfxsxzLCKA 6Cw3uKQKKRedocMtfZVfCxHoeZh2h6 yueguanjia-bucket ygj-customer-$VERSION.apk app/customer/apk/ygj-customer.apk
